package com.corona.game;

import com.corona.Game;

/* loaded from: pokewilds.jar:com/pkmngen/game/Synced.class */
public class Synced {

    /* loaded from: pokewilds.jar:com/pkmngen/game/Synced$HashMap.class */
    static class HashMap<T, U> {
        public Player player;
        String objectName;
        java.util.HashMap<T, U> object = new java.util.HashMap<>();
        U response;

        public HashMap(String objectName) {
            this.objectName = objectName;
        }

        public U get(T key) {
            if (Game.staticGame.type == Game.Type.SERVER) {
                return this.object.get(key);
            }
            Game.staticGame.client.sendTCP(new Network.SyncedHashMap(this.objectName, "get", null));
            while (this.response == null) {
                try {
                    Thread.sleep(1);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            U response = this.response;
            this.response = null;
            return response;
        }

        public void put(T key, U val) {
            this.object.put(key, val);
        }
    }
}
